<template>
    <div class="alarmConfiguration zy-content pd50">
        <back-level @click="close" />
        <search :columns="searchData" @getSearch="getSearch(arguments)"></search>
        <div class="alarmConfiguration">
            <div class="list-layout mt16">
                <div class="btns clear">
                    <span class="title">记录详情</span>
                </div>
                <!-- 表格 -->
                <div class="tableContent">
                    <Table class="resizable-table" border @on-column-width-resize="onColumnWidthResize" :columns="columns"
                        ellipsis ref="selection" stripe :data="dataArr">
                        <template slot-scope="{ row }" slot="action">
                            <span class="operationBtn" @click="delRow(row)"><i class="iconfont zy-common-shanchu"></i>{{
                                $t("common.Delete") }}</span>
                        </template>
                    </Table>
                </div>
                <!-- 分页 -->
                <div class="pageWrap mt16">
                    <pageLeftTitle :total="total" :selected="delIds.length" />
                    <Page :total="total" :page-size="pageSize" :page-size-opts="pageSizeOption" :current="pageNum"
                        @on-change="changePageNum" @on-page-size-change="changePageSize" show-sizer show-total />
                </div>
            </div>
        </div>
    </div>
</template>
<script>
import search from "@/components/curd/searchList.vue";
import toggleTableOperation from "@/mixins/toggleTableOperation";
export default {
    name: "operationRecordsDetail",
    components: { search },
    mixins: [toggleTableOperation],
    data() {
        return {
            searchData: [
                {
                    title: '操作人',
                    key: 'operUserName',
                    type: 'search',
                    dicUrl:'/basic/user/searchUser',
                    // queryMethod:'post',
                    queryName:'key',
                    align: 'center',
                    // queryParams:{
                    //     pageSize:99,
                    //     pageNum:1
                    // },
                    resultParams:'res.data',
                    params: {
                        label:'realname',
                        value:'realname',
                    },
                },
                {
                    title: '设备编号',
                    key: 'deviceCode',
                    align: 'center'
                },
                {
                    title: '操作时间',
                    key: 'operTimeV',
                    type:'date',
                    align: 'center'
                },
            ],
            columns: [
                {
                    title: "操作时间",
                    key: "operTime",
                    minWidth: 100,
                    align: "center",
                    resizable: true,
                    tooltip: true,
                },
                {
                    title: "操作人",
                    key: "operUserName",
                    minWidth: 100,
                    align: "center",
                    resizable: true,
                    tooltip: true,
                },
                {
                    title: "工单号",
                    key: "workCode",
                    minWidth: 100,
                    align: "center",
                    resizable: true,
                    tooltip: true,
                },
                {
                    title: "设备编号",
                    key: "deviceCode",
                    minWidth: 100,
                    align: "center",
                    resizable: true,
                    tooltip: true,
                },
                {
                    title: "模具编号",
                    key: 'moldCode',
                    minWidth: 100,
                    align: "center",
                    resizable: true,
                    tooltip: true,
                },
                {
                    title: "操作内容",
                    key: 'operAction',
                    fixed: "right",
                    minWidth: 180,
                    align: "center",
                },
            ],
            loading: false,
            //三级搜索参数
            searchParams: {},

            //一级页面分页参数
            pageNum: 1,
            pageSize: 10,
            total: 0,

            dataArr: [],
            userList: [],
            allCheck: false,
            create: false,
            delFaultCodeShowF: false, //是否显示删除弹窗
            pageSizeOption: [10, 20, 30, 40],
            delIds: [],
            selection: [],
            selectList: [],
            targetRow: {},
        };
    },
    mounted() {
        this.getTableColumnsWidth(this.columns);
        this.searchList();
    },
    methods: {
        getSearch(params) {
            this.searchParams = JSON.parse(JSON.stringify(params[0]));
            this.pageNum=1;
            this.searchList();
        },
        reset() {
            this.searchParams = {};
            this.changeNum();
        },
        //分页
        changeNum() {
            this.pageNum = 1;
            this.searchList();
        },
        changePageSize(pageSize) {
            this.pageSize = pageSize;
            this.searchList();
        },
        changePageNum(val) {
            this.pageNum = val;
            this.searchList();
        },
        //查询列表
        searchList() {
            let params = {
                pageNum: this.pageNum,
                pageSize: this.pageSize,
                workCode: this.$route.query.workCode,
            };
            for (let key in this.searchParams) {
                if (this.searchParams[key]) {
                    this.$set(params, key, this.searchParams[key]);
                }
            }
            this.axios({
                url: "/dms/productionWork/queryProdWorkRecordList",
                data: params,
                method: "post",
            }).then((res) => {
                if (res.code === 200) {
                    this.dataArr = res.data.records;
                    this.total = res.data.total;
                } else {
                    this.$Message.warning({
                        content: res.msg,
                        duration: 6,
                        closable: true,
                    });
                }
            });
        },
        getUserList(query) {
            this.axios({
                method: 'POST',
                url: '/dms/deviceUser/selectNotAssUserPage',
                data: {
                    pageNum: 1,
                    pageSize: 9999,
                    realname:query,
                }
            }).then(res => {
                if (res.code === 200) {
                    this.userList = res.data.records
                } else {
                    this.$Message.warning(({ content: res.msg, duration: 6, closable: true }));
                }
            })
        },
    },
};
</script>
      
<style scoped lang="scss">
.ivu-input-number {
    width: -webkit-fill-available;
}

.btn-box {
    padding: 8px 5px !important;
}
</style>